﻿namespace BuzzX8.Xmpp.StreamElements.Factories
{
    public class StreamHeaderFactory : DatagramElementFactory<StreamHeader, StreamHeaderModel>
    {
        protected override StreamHeaderModel CreateModelByParameters(PropertyDictionary parameters)
        {
            return new StreamHeaderModel(parameters);
        }

        protected override StreamHeader CreateNewElement()
        {
            return new StreamHeader(DefaultModel.StreamType);
        }

        protected override void UpdateElementByModel(StreamHeader element, StreamHeaderModel model)
        {
            base.UpdateElementByModel(element, model);
            element.StreamType = model.StreamType;
            element.Version = model.Version;
        }

        protected override ErrorElement CreateNewErrorElement()
        {
            return new StreamError();
        }
    }
}
